package org.romzzz.gwtclassifieds.client.service;

import java.util.List;
import org.romzzz.gwtclassifieds.client.data.CategoryBean;
import org.romzzz.gwtclassifieds.client.data.ClassifiedBean;
import org.romzzz.gwtclassifieds.client.exception.AuthenticationException;
import org.romzzz.gwtclassifieds.client.exception.RpcException;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

/**
 * The client side stub for the RPC service.
 */
@RemoteServiceRelativePath("gwtclassifieds")
public interface ClassifiedService extends RemoteService {
	
	public static class App {
        private static ClassifiedServiceAsync app = null;
        public static synchronized ClassifiedServiceAsync getInstance() {
            if (app == null) {
                app = GWT.create(ClassifiedService.class);
            }
            return app;
        }
    }
	
	public Boolean enableAdminMode() throws AuthenticationException;
	
	public List<CategoryBean> getCategories() throws RpcException;
	
	public List<CategoryBean> addCategory(CategoryBean category) throws RpcException;
	
	public List<CategoryBean> removeCategory(CategoryBean category) throws RpcException;
	
	public List<ClassifiedBean> getAllClassifieds() throws RpcException;
	
	public List<ClassifiedBean> getCategorizedClassifieds(List<CategoryBean> categories) throws RpcException;
	
	public List<ClassifiedBean> addClassified(ClassifiedBean classified, String password, List<CategoryBean> categories) throws RpcException;
	
	public Long checkAcces(Long id, String password) throws RpcException, AuthenticationException;
	
	public List<ClassifiedBean> updateClassified(ClassifiedBean classified, Long token, List<CategoryBean> categories) throws RpcException, AuthenticationException;
	
	public List<ClassifiedBean> removeClassified(Long id, String password, List<CategoryBean> categories) throws RpcException, AuthenticationException;
	
	public Boolean sendFeedback(String name, String message) throws RpcException;
	
}
